﻿@{
    Layout = null;
}
<!DOCTYPE html> 
<html>
    <head>
        <title>@Language.Get("找回密码")</title>
        @Html.Partial("commonMeta")
    </head>
    <body>
    	<div class="views">
			<div class="view view-main">
				<div class="navbar">
					<div class="navbar-inner">
			             @* 头部start *@
			            <header>
			                <a class="menu_icon_box" href="javascript:history.go(-1);">
								<b class="back-btn"></b>
							</a>
			                <h2>@Language.Get("找回密码")</h2>
			            </header>
			            @* 头部end *@
					</div>
			    </div> 
				<div class="pages navbar-through toolbar-through">
		          	<div data-page="index" class="page">
						<div class="page-content" id="app_no_header">
							<!--内容区start-->
							
                			 <article>
				             <ul id="forgot-data" class="layout-box forgot-box">
				                 <li>
				                     <em class="user-icon"></em>
				                     <input type="text" id="userName" class="input-box" placeholder="@Language.Get("请输入用户名")" required="required" autofocus="autofocus"/>
				                 </li>
				                
				                <li>
				                     <em class="phone-icon"></em>
				                     <input type="tel" id="mobile" class="input-box" required="required" autofocus="autofocus" placeholder="@Language.Get("请输入手机号")" maxlength="11"/>
				                 </li>
				                 <li>
				                     <em class="pwd-icon"></em>
				                     <input type="password" id="Pwd" class="input-box" placeholder="@Language.Get("请输入密码")" required="required" autofocus="autofocus" />
				                 </li>
				             </ul>
				               <a class="sure-btn forgot-btn">@Language.Get("确定")</a>
				         </article>
				             <div class="tip-box forgot-tip-box">
				                 <div class="tip forgot-tip">
				                     <p class="msg forgot-msg"></p>
				                     <span class="colse-tip-btn">@Language.Get("确定")</span>
				                 </div>
				             </div>
		                
		                <!--内容区end-->
		                
        			 </div>
		       		</div>
		       </div>
			</div>
		</div>

        </body>
    </html>
<script src="~/Js/jquery.min.js"></script>
<script type="text/javascript" src="~/Js/framework/framework7.js"></script>
<script>
    $(function () {
        //确定按钮
        $(".forgot-btn").click(function () {
            var username = $("#userName").val();//获取输入的用户名
            var pwd = $("#Pwd").val();//获取新密码
            var mobile = $("#mobile").val();//获取输入的手机号
            if (username && pwd && mobile) {//都不为空
                VerifyUserNameMobile();//验证手机号和用户名是否一致
            }
            else {
                $(".forgot-tip-box").show();//显示提示盒子
                $(".forgot-msg").html(_("请填写资料"));
            }
        });

        //关闭错误提示按钮
        $(".colse-tip-btn").click(function () {
            $(".forgot-tip-box").hide();//隐藏提示盒子
            //$(".login-box .login-pwd").val("");
        });

        //验证手机和用户名
        function VerifyUserNameMobile() {
            var requestForgotCustomer = {};
            requestForgotCustomer.UserName = $("#userName").val(); //获取用户名
            requestForgotCustomer.Password = $("#Pwd").val();//获取密码
            requestForgotCustomer.Mobile = $("#mobile").val();//获取手机号
            $.ajax({
                url: "/Customer/CustomerForgotPassword",//提交地址
                type: "POST",//提交方式
                data: JSON.stringify(requestForgotCustomer),
                contentType: "application/json; charset=utf-8",
                success: function (result) {
                    var _result = eval('(' + result + ')');//eval()解析单个json对象

                    if (_result['msgcode'] == false) {
                        $(".forgot-tip-box").show();
                        $(".forgot-msg").html(_("资料不对应，请重新输入"));
                    } else {
                        $(".forgot-tip-box").show();
                        $(".forgot-msg").html(_("修改成功"));
                    }
                }
            });
        }


    });
</script>